import get from '@dfeidao/atom-web/global/get';
import { IFeidaoAiBrowserComponent } from '@dfeidao/atom-web/interfaces';
import nodejs from '@dfeidao/atom-web/msg/nodejs';
import render from '@dfeidao/atom-web/render/render';
import set_node_cls from '@dfeidao/atom-web/ui/set-node-cls';
import show from '@dfeidao/atom-web/ui/show';
import p001 from './p001';
import p002 from './p002';
import p004 from './p004';
export default async function a004(fd: IFeidaoAiBrowserComponent) {
	// todo
	const show1 = fd.data.node.querySelector<HTMLDivElement>('[data-id="Add"]');
	set_node_cls(show1, 'display-n', false);
	const no = get('staff_no');

	const vv = await nodejs<{ dtt: Array<{ project_name: string, project_no: string }>; c: number }>
		('inventory-of-assets/zj-000002/s001', { filter: { staff_no: no } });

	render(fd, vv.dtt, p001, 'p001', 'inner');

	if (vv.dtt.length > 20) {
		render(fd, vv.c, p004, 'p004', 'inner');

		show(fd.data.node);
	}
	const s  = -1;
	const res = await nodejs<{ dt2: Array<{}>; }>('inventory-of-assets/zj-000002/s002', {
		filter: {
			project_no: s
		}
	});
	render(fd, res.dt2, p002, 'p002', 'inner');

}
